<template>
  <uni-popup ref="popupADVIP" type="center" :mask-click="false">
    <view v-if="!showMergePopup" class="container flex-col">
      <view class="content-container">
        <text class="text_black">请您认真阅读</text>
        <text class="text_green" @click="toVipProtocol">《驾考会员协议》</text>
        <text class="text_black">的全部条款，同意后可开始使用我们的会员服务</text>
      </view>
      <view class="line"></view>
      <view class="flex-row">
        <view class="btn-container" style="color: #787878;" @click="close">
          取消
        </view>
        <view class="vLine"></view>
        <view class="btn-container" style="color: #3073f6;" @click="agree">
          同意
        </view>
      </view>
    </view>
  </uni-popup>
</template>

<script>

export default {
  name: "agreemengdialog",
  data() {
    return {
      showMergePopup: false,
    };
  },
  methods: {
    open() {
      this.$refs.popupADVIP.open()
      return new Promise((resolve, reject) => {
        this.agreeFn = resolve
        this.noAgreeFn = reject
      })
    },
    close() {
      this.$refs.popupADVIP.close()
      this.agreeFn = null
      if (this.noAgreeFn) {
        this.noAgreeFn()
        this.noAgreeFn = null
      }
    },
    agree() {
      this.$refs.popupADVIP.close()
      this.noAgreeFn = null
      if (this.agreeFn) {
        this.agreeFn()
        this.agreeFn = null
      }
    },
    toVipProtocol() {
      uni.navigateTo({
        url: '/pages/webview/webview?type=vip'
      })
    }
  }
}
</script>

<style lang="scss">
.container {
  width: 586upx;
  position: relative;
  background-color: #fff;
  border-radius: 28upx;

  .content-container {
    line-height: 22px;
    margin: 46upx 66upx 0 66upx;

    .text_black {
      color: rgba(83, 83, 83, 1);
      font-size: 28upx;
    }

    .text_green {
      color: #3073f6;
      font-size: 28upx;
    }
  }

  .line {
    margin-top: 36upx;
    width: 586upx;
    height: 1upx;
    background-color: #E7E7E7;
  }

  .btn-container {
    flex: 1;
    height: 100upx;
    font-size: 30upx;
    display: flex;
    justify-content: center;
    align-items: center;
  }

  .vLine {
    width: 1upx;
    height: 100upx;
    background-color: #EBEBEB;
  }
}
</style>
